$(function () {

    $("#codeImg").click(function () {

        $("#codeImg").attr("src",basePath+"verifyCode/verify?time="+new Date().getTime());

    });

})

$(function () {
    $("#logic").on("click",function (e) {
        e.preventDefault()
        var username=$("#username").val();
        var password=$("#password").val();
        var identify=$("#identify").val();
        var rememberMe=$("#rememberMe").is(":checked");

        if(username===""){
            alert("用户名不能为空,请重新输入")
            location.reload()
        }
        if(password===""){
            alert("密码不能为空,请重新输入")
            location.reload()
        }

        console.log("username========"+username)
        console.log("password============="+password)
        console.log("identify============="+identify)
        console.log("rememberMe==============="+rememberMe)
        var loginReqVO={
            username:username,
            password:password,
            identify:identify,
            rememberMe:rememberMe
        }
        console.log("----------------")
        $.ajax({
            url:basePath+"login",
            type:"POST",
            contentType:"application/json",
            data:JSON.stringify(loginReqVO),
            success:function (data) {
                console.log(data)
                if(data.code==200){
                    console.log("***********************")
                    alert(data.msg)
                    location.href="/main-news";
                }else {
                    console.log("-----------------------")
                    alert(data.msg)
                    location.reload()
                }
            },
        })
    })
})